<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>9.电话号码模糊处理</title>
</head>
<body>
  <script>
    //重复函数
   // console.log("*".repeat(3));
    function phone(mobile,len=3) {
    return String(mobile).slice(0,len*-1)+'*'.repeat(len);
    }
    console.log(phone("123452344"));
    document.body.innerHTML = phone("13412345145",6);
  </script>
</body>
</html>